#ifndef VECTOR_H
#define VECTOR_H

class Vector {
public:
	double x;
	double y;
	double z;

public:
	static const Vector NULL_VECTOR;
	static const Vector UP;
	static const Vector DOWN;
	static const Vector LEFT;
	static const Vector RIGHT;
	static const Vector NEAR;
	static const Vector FAR;

public:
	Vector(const double X, const double Y, const double Z);
	Vector(const Vector &cpy);

	void set(const Vector &cpy);
	void set(const double X, const double Y, const double Z);

	Vector& rotateOnX(const double &radAngle);
	Vector& rotateOnY(const double &radAngle);
	Vector& rotateOnZ(const double &radAngle);
	Vector& normalize();
	Vector& cross(const Vector &r);
	double dot(const Vector &r) const;
	double squareLenght() const;
	double length() const;

	// Same as this->rotateOnX(Math.toRadians(90)), but faster
	Vector& turnLeftOnX();
	// Same as this->rotateOnX(Math.toRadians(-90)), but faster
	Vector& turnRightOnX();
	// Same as this->rotateOnY(Math.toRadians(90)), but faster
	Vector& turnLeftOnY();
	// Same as this->rotateOnY(Math.toRadians(-90)), but faster
	Vector& turnRightOnY();
	// Same as this->rotateOnZ(Math.toRadians(90)), but faster
	Vector& turnLeftOnZ();
	// Same as this->rotateOnZ(Math.toRadians(-90)), but faster
	Vector& turnRightOnZ();

	Vector& invert();
	Vector& add(const Vector &op2);
	Vector& add(const double &x, const double &y, const double &z);
	Vector& subtract(const Vector &op2);
	Vector& subtract(const double &x, const double &y, const double &z);
	Vector& scalarProduct(const double &scalar);
	Vector& scalarDivision(const double &scalar);
	Vector& interpolate(const Vector &op2, const double &alpha);

	bool isUnit() const;
	bool isPerpendicular(const Vector &r) const;
	bool isNull() const;
	bool isLonger(const Vector &r) const;
	bool isLonger(const double &lenght) const;
	bool isShorter(const Vector &r) const;
	bool isShorter(const double &lenght) const;
};

#endif // VECTOR_H
